import { createStore } from "redux";

const initState = {
  accessToken: "At_0000af83defad3ed4810843dd1546ea5",
  currentPage: 1,
  deviceList: [],
  deviceIDList: [], // 设备ID列表
  hospitalNameList: [],
  isHide: true,
  play_info: {
    deviceId: 'a',
    channelId: '0',
    type: 1,
    streamId: 0,
    kitToken: 'a',
  },
}

const reducer = (state = initState, action) => {
  switch (action.type) {
    case 'update_data':
      return Object.assign({}, state, action.data);
    default:
      return state;
  }
}
const store = createStore(reducer);
export const updateData = data => store.dispatch({
  type: 'update_data',
  data
});
export {
  store
};